/*******************************************************************************
Name: market_analysis
*******************************************************************************/

clear

capture log close

log using "${logdir}4-market_analysis.log", replace

/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
*OPEN AND APPEND COHORT DATA
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/

use "${datadir}ls_70.dta"
append using "${datadir}ls_80.dta"
append using "${datadir}ls_90.dta"
append using "${datadir}ls_00.dta"

*defined matched cohorts: those included in 1970 data
egen matched = max(year == 1970), by(metarea)

*merge in MSA-level data on employment and central city employment
merge metarea year using "${datadir}pop_working.dta", sort uniqusing

tab _merge
keep if _merge == 3
drop _merge

*define cohorts ("group")

egen group = group(sex educ_cat cohort_cat race)

egen groupXmetarea = group(metarea group)

*order years for tsset
gen order = 0
replace order = 1 if year == 1970
replace order = 2 if year == 1980
replace order = 3 if year == 1990
replace order = 4 if year == 2000

gen ln_idle = ln(idle)

*indicators for number of observations in cell
gen size50 = count >= 50
gen size25 = count >= 25

*merge in highway data
merge metarea year using "${rawdir}highway.dta", sort uniqusing

drop if _merge == 2

drop _merge


*merge in 1970 fraction black data
merge metarea using "${rawdir}frac_black_70.dta", uniqusing sort
drop if _merge == 2
drop _merge

rename frac_black fblack_msa70

tsset groupXmetarea order

/*----------------------------------------------------------------------*/
*DEFINE VARIABLES
/*----------------------------------------------------------------------*/

*suburbanization measures
gen fcc = emp_tot_cc/emp_tot

gen ln_fcc = ln(fcc)
gen ln_fcc_1d = ln_fcc - L1.ln_fcc
gen ln_fcc_2d = ln_fcc - L2.ln_fcc
gen ln_fcc_3d = ln_fcc - L3.ln_fcc

gen ln_tot = ln(emp_tot)
gen ln_tot_1d = ln_tot - L1.ln_tot
gen ln_tot_2d = ln_tot - L2.ln_tot
gen ln_tot_3d = ln_tot - L3.ln_tot

**define labor supply outcomes (in differences)

*log unemployed (idle) rates
gen ln_idle_fd = ln_idle - L1.ln_idle

*level unemployed (idle) rates
gen idle_fd = idle - L1.idle

gen active = 1 - idle
gen ln_active = ln(1 - idle)

gen active_1d = active - L1.active
gen active_2d = active - L2.active
gen active_3d = active - L3.active

gen ln_active_1d = ln_active - L1.ln_active
gen ln_active_2d = ln_active - L2.ln_active
gen ln_active_3d = ln_active - L3.ln_active

gen ln_inc = ln(incwage)

gen inc_1d = incwage - L1.incwage
gen inc_2d = incwage - L2.incwage
gen inc_3d = incwage - L3.incwage

gen ln_inc_1d = ln_inc - L1.ln_inc
gen ln_inc_2d = ln_inc - L2.ln_inc
gen ln_inc_3d = ln_inc - L3.ln_inc

gen active_sq = active^2
gen ln_active_sq = ln_active^2
gen inc_sq = (incwage^2)/1000
gen ln_inc_sq = ln_inc^2


*define black interaction terms
gen black = (race == 2)

gen blackXln_fcc_1d = black*(ln_fcc_1d)
gen blackXln_fcc_2d = black*(ln_fcc_2d)
gen blackXln_fcc_3d = black*(ln_fcc_3d)

gen blackXln_tot_1d = black*(ln_tot_1d)
gen blackXln_tot_2d = black*(ln_tot_2d)
gen blackXln_tot_3d = black*(ln_tot_3d)

gen blackXactive = black*(active)
gen blackXln_active = black*(ln_active)
gen blackXincwage = black*incwage
gen blackXln_inc = black*(ln_inc)

gen blackXactive_sq = blackXactive^2
gen blackXln_active_sq = blackXln_active^2
gen blackXinc_sq = blackXincwage^2
gen blackXln_inc_sq = blackXln_inc^2

/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
*ESTIMATION
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/

/*----------------------------------------------------------------------*/
*IDENTIFY MATCHED MSAS
/*----------------------------------------------------------------------*/

*baseline models
areg ln_active_1d ln_fcc_1d [aw = count] if year == 1980 & race == 2 & size25 == 1 & L1.size25 == 1 & matched, absorb(group) cluster(metarea)
areg active_1d ln_fcc_1d [aw = count] if year == 1980 & race == 2 & size25 == 1 & L1.size25 == 1 & matched, absorb(group) cluster(metarea)

*identify matched MSAs
egen matched_msas = max(e(sample)), by(metarea)

*replace problematic MSAs (15% or more loss in coverage)
replace matched_msas = 0 if metarea == 116 | metarea == 312 | metarea == 328 | metarea == 256 | metarea == 452 | ///
	metarea == 492 | metarea == 548 | metarea == 592 | metarea == 678 | metarea == 684 | metarea == 916 | metarea == 264 | ///
	metarea == 3160 | metarea == 3760 | metarea == 5160 | metarea == 588

*drop augusta,ga -- confusing consolidation
replace matched_msas = 0 if metarea == 60

preserve

keep if matched_msas == 1

collapse (mean) matched_msas, by(metarea)

save "${datadir}matched_msas.dta", replace

restore

/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
*TABLE 2: DESCRIPTIVE STATISTICS
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/


areg ln_active_1d blackXln_fcc_1d ln_fcc_1d [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
egen samp1 = max(e(sample)), by(metarea sex race cohort_cat educ_cat)

areg ln_active_1d blackXln_fcc_2d ln_fcc_2d [aw = count] if year == 1990 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
egen samp2 = max(e(sample)), by(metarea sex race cohort_cat educ_cat)

areg ln_active_1d blackXln_fcc_3d ln_fcc_3d [aw = count] if year == 2000 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
egen samp3 = max(e(sample)), by(metarea sex race cohort_cat educ_cat)

gen weight = count
replace weight = 5*count/2 if year == 1970

sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1970
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1980
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1990
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 2000

gen female = sex == 2

sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

gen cohort2 = cohort_cat == 2
gen cohort3 = cohort_cat == 3
gen cohort4 = cohort_cat == 4
gen cohort5 = cohort_cat == 5
gen cohort6 = cohort_cat == 6

sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum cohort2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum cohort3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum cohort4 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum cohort5 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum cohort6 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

gen educ1 = educ_cat == 1
gen educ2 = educ_cat == 2
gen educ3 = educ_cat == 3

sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & !female

sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & !female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & !female

sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & female

sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & female
sum active [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & female

sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum fcc [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black
sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black
sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black

sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black
sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black
sum ln_fcc_1d [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black

*golden cohort

sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & cohort_cat == 4
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & cohort_cat == 4
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & cohort_cat == 4
sum black [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & cohort_cat == 4

sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & cohort_cat == 4

sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & cohort_cat == 4
sum female [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & cohort_cat == 4

sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & cohort_cat == 4

sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & cohort_cat == 4
sum educ1 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & cohort_cat == 4

sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & cohort_cat == 4

sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & cohort_cat == 4
sum educ2 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & cohort_cat == 4

sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & black & cohort_cat == 4

sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1970 & !black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1980 & !black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 1990 & !black & cohort_cat == 4
sum educ3 [aw = weight] if (samp1 | samp2 | samp3) & year == 2000 & !black & cohort_cat == 4

*all 24-64 year olds

table year if matched_msas == 1 & black == 1 & female == 0 [aw = weight], c(mean active)
table year if matched_msas == 1 & black == 0 & female == 0 [aw = weight], c(mean active)

table year if matched_msas == 1 & black == 1 & female == 1 [aw = weight], c(mean active)
table year if matched_msas == 1 & black == 0 & female == 1 [aw = weight], c(mean active)

/*----------------------------------------------------------------------*/
*TABLE 3: JOB SUBURBANIZATION AND BASELINE CELL AND MSA CHARACTERISTICS
/*----------------------------------------------------------------------*/

merge year metarea race sex cohort_cat educ_cat using "${datadir}ls_70_panel.dta", sort uniqusing

drop if _merge == 2
drop _merge

*merge in crime statistics
merge metarea using "${rawdir}crime_70.dta", sort uniqusing

drop if _merge == 2
drop _merge

*merge in segregation statistics
merge metarea year using "${rawdir}seg.dta", uniqusing sort keep(dism)
drop if _merge == 2
drop _merge


tsset groupXmetarea order


*MSA characteristics

areg active_fd5yr F1.blackXln_fcc_1d F1.ln_fcc_1d ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg ln_active_fd5yr F1.blackXln_fcc_1d F1.ln_fcc_1d ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)

*short-run suburbanization

areg L1.active blackXln_fcc_1d ln_fcc_1d ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L1.ln_inc blackXln_fcc_1d ln_fcc_1d ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L1.fcc blackXln_fcc_1d ln_fcc_1d ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg fblack_msa blackXln_fcc_1d ln_fcc_1d ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)


areg z_violent_rate blackXln_fcc_1d ln_fcc_1d ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg z_property_rate blackXln_fcc_1d ln_fcc_1d ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
	 

areg L1.dism blackXln_fcc_1d ln_fcc_1d ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

*long-run suburbanization

areg active_fd5yr F3.blackXln_fcc_3d F3.ln_fcc_3d ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg ln_active_fd5yr F3.blackXln_fcc_3d F3.ln_fcc_3d ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)


areg L3.active blackXln_fcc_3d ln_fcc_3d ///
	[aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L3.ln_inc blackXln_fcc_1d ln_fcc_1d ///
	[aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L3.fcc blackXln_fcc_3d ln_fcc_3d ///
	[aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg fblack_msa blackXln_fcc_3d ln_fcc_3d ///
	 [aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)




areg z_violent_rate blackXln_fcc_3d ln_fcc_3d ///
	 [aw = count] if year == 2000 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg z_property_rate blackXln_fcc_3d ln_fcc_3d ///
	 [aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
	 

areg L3.dism blackXln_fcc_3d ln_fcc_3d ///
	 [aw = count] if year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas, absorb(group) cluster(metarea)



/*----------------------------------------------------------------------*/
*TABLE 4: JOB SUBURBANIZATION AND LABOR MARKET OUTCOMES
/*----------------------------------------------------------------------*/

egen edXmetarea = group(educ_cat metarea)

***1970-1980

gen sample1 = (year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas == 1)

*employment
areg ln_active_1d blackXln_fcc_1d ln_fcc_1d [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
areg ln_active_1d blackXln_fcc_1d L1.blackXln_active L1.blackXln_active_sq ln_fcc_1d L1.ln_active L1.ln_active_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
areg ln_active_1d blackXln_fcc_1d L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq i.group [aw = count] if sample1 == 1, absorb(edXmetarea) cluster(metarea)


*income
areg ln_inc_1d blackXln_fcc_1d ln_fcc_1d [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
areg ln_inc_1d blackXln_fcc_1d L1.blackXln_inc L1.blackXln_inc_sq ln_fcc_1d L1.ln_inc L1.ln_inc_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
areg ln_inc_1d blackXln_fcc_1d L1.blackXln_inc L1.blackXln_inc_sq ln_fcc_1d L1.ln_inc L1.ln_inc_sq i.group [aw = count] if sample1 == 1, absorb(edXmetarea) cluster(metarea)

***1970-1990

gen sample2 = (year == 1990 & size25 == 1 & L2.size25 == 1 & matched_msas == 1)

*employment
areg ln_active_2d blackXln_fcc_2d ln_fcc_2d [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
areg ln_active_2d blackXln_fcc_2d L2.blackXln_active L2.blackXln_active_sq ln_fcc_2d L2.ln_active L2.ln_active_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
areg ln_active_2d blackXln_fcc_2d L2.blackXln_active L2.blackXln_active_sq ln_fcc_2d L2.ln_active L2.ln_active_sq i.group [aw = count] if sample2 == 1, absorb(edXmetarea) cluster(metarea)

*income
areg ln_inc_2d blackXln_fcc_2d ln_fcc_2d [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
areg ln_inc_2d blackXln_fcc_2d L2.blackXln_inc L2.blackXln_inc_sq ln_fcc_2d L2.ln_inc L2.ln_inc_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
areg ln_inc_2d blackXln_fcc_2d L2.blackXln_inc L2.blackXln_inc_sq ln_fcc_2d L2.ln_inc L2.ln_inc_sq i.metarea [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
areg ln_inc_2d blackXln_fcc_2d L2.blackXln_inc L2.blackXln_inc_sq ln_fcc_2d L2.ln_inc L2.ln_inc_sq i.group [aw = count] if sample2 == 1, absorb(edXmetarea) cluster(metarea)


***1970-2000

gen sample3 = (year == 2000 & size25 == 1 & L3.size25 == 1 & matched_msas == 1)

*employment
areg ln_active_3d blackXln_fcc_3d ln_fcc_3d [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq i.group [aw = count] if sample3 == 1, absorb(edXmetarea) cluster(metarea)

*income
areg ln_inc_3d blackXln_fcc_3d ln_fcc_3d [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq i.group [aw = count] if sample3 == 1, absorb(edXmetarea) cluster(metarea)



/*----------------------------------------------------------------------*/
*TABLE 6: HIGHWAYS, JOB SUBURBANIZATION, AND LABOR MARKET OUTCOMES
/*----------------------------------------------------------------------*/

egen racc70 = max(racc*(year == 1970)), by(metarea)
egen raysxplan70 = max(raysxplan*(year == 1970)), by(metarea)
egen rcarea70 = max(rcarea*(year == 1970)), by(metarea)

gen blackXrcarea70 = black*rcarea70
gen blackXracc70 = black*racc70
gen blackXraysxplan70 = black*raysxplan70

**FIRST STAGE

xi i.group

areg ln_fcc_1d racc70 blackXracc70 rcarea70 blackXrcarea70 [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_fcc_1d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 i.group [aw = count] if sample1 == 1, cluster(metarea)

areg ln_fcc_2d racc70 blackXracc70 rcarea70 blackXrcarea70 [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_fcc_2d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 i.group [aw = count] if sample2 == 1, cluster(metarea)

areg ln_fcc_3d racc70 blackXracc70 rcarea70 blackXrcarea70 [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_fcc_3d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 i.group [aw = count] if sample3 == 1, cluster(metarea)

**EMPLOYMENT RATES

areg ln_active_1d blackXracc70 blackXrcarea70 racc70 rcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_active_1d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq ///
	 i.group [aw = count] if sample1 == 1, cluster(metarea)
ivregress 2sls ln_active_1d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq ///
	 i.group i.edXmetarea [aw = count] if sample1 == 1, cluster(metarea)
	 
areg ln_active_2d blackXracc70 blackXrcarea70 racc70 rcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_active_2d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq ///
	 i.group [aw = count] if sample2 == 1, cluster(metarea)
ivregress 2sls ln_active_2d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq ///
	 i.group i.edXmetarea [aw = count] if sample2 == 1, cluster(metarea)

areg ln_active_3d blackXracc70 blackXrcarea70 racc70 rcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_active_3d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq ///
	i.group [aw = count] if sample3 == 1, cluster(metarea)
ivregress 2sls ln_active_3d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq ///
	i.group i.edXmetarea [aw = count] if sample3 == 1, cluster(metarea)
	
**INCOME

areg ln_inc_1d blackXracc70 blackXrcarea70 racc70 rcarea70 L1.blackXln_inc L1.blackXln_inc_sq L1.ln_inc L1.ln_inc_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_inc_1d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L1.blackXln_inc L1.blackXln_inc_sq L1.ln_inc L1.ln_inc_sq ///
	 i.group  [aw = count] if sample1 == 1, cluster(metarea)
ivregress 2sls ln_inc_1d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L1.blackXln_inc L1.blackXln_inc_sq L1.ln_inc L1.ln_inc_sq ///
	 i.group i.edXmetarea [aw = count] if sample1 == 1, cluster(metarea)

areg ln_inc_2d blackXracc70 blackXrcarea70 racc70 rcarea70 L2.blackXln_inc L2.blackXln_inc_sq L2.ln_inc L2.ln_inc_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_inc_2d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L2.blackXln_inc L2.blackXln_inc_sq L2.ln_inc L2.ln_inc_sq ///
	 i.group [aw = count] if sample2 == 1, cluster(metarea)
ivregress 2sls ln_inc_2d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L2.blackXln_inc L2.blackXln_inc_sq L2.ln_inc L2.ln_inc_sq ///
	 i.group i.edXmetarea [aw = count] if sample2 == 1, cluster(metarea)

areg ln_inc_3d blackXracc70 blackXrcarea70 racc70 rcarea70 L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_inc_3d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L3.blackXln_inc L3.blackXln_inc_sq L3.ln_inc L3.ln_inc_sq ///
	i.group [aw = count] if sample3 == 1, cluster(metarea)
ivregress 2sls ln_inc_3d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L3.blackXln_inc L3.blackXln_inc_sq L3.ln_inc L3.ln_inc_sq ///
	i.group i.edXmetarea [aw = count] if sample3 == 1, cluster(metarea)
	
	
/*----------------------------------------------------------------------*/
*TABLE A7: HIGHWAYS AND GROUP-SPECIFIC WEIGHTED SECTOR GROWTH
/*----------------------------------------------------------------------*/

merge year metarea race sex cohort_cat educ_cat using "${datadir}ind_index.dta", sort

drop if _merge == 2
drop _merge

merge year metarea race sex cohort_cat educ_cat using "${datadir}occ_index.dta", sort

drop if _merge == 2
drop _merge

tsset groupXmetarea order

***BY INDUSTRY
areg ln_share_ind_1d racc70 blackXracc70 rcarea70 blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_ind_1d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq i.group [aw = count] if sample1 == 1, cluster(metarea)
ivregress 2sls ln_share_ind_1d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq i.group i.edXmetarea [aw = count] if sample1 == 1, cluster(metarea)

sum ln_share_ind_1d if e(sample)
sum ln_share_ind_1d if e(sample) & race == 1
sum ln_share_ind_1d if e(sample) & race == 2

areg ln_share_ind_2d racc70 blackXracc70 rcarea70 blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_ind_2d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq i.group [aw = count] if sample2 == 1, cluster(metarea)
ivregress 2sls ln_share_ind_2d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq i.group i.edXmetarea [aw = count] if sample2 == 1, cluster(metarea)

sum ln_share_ind_2d if e(sample)
sum ln_share_ind_2d if e(sample) & race == 1
sum ln_share_ind_2d if e(sample) & race == 2

areg ln_share_ind_3d racc70 blackXracc70 rcarea70 blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_ind_3d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq i.group [aw = count] if sample3 == 1, cluster(metarea)
ivregress 2sls ln_share_ind_3d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq i.group i.edXmetarea [aw = count] if sample3 == 1, cluster(metarea)

sum ln_share_ind_3d if e(sample)
sum ln_share_ind_3d if e(sample) & race == 1
sum ln_share_ind_3d if e(sample) & race == 2

***BY OCCUPATION

areg ln_share_occ_1d racc70 blackXracc70 rcarea70 blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq [aw = count] if sample1 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_occ_1d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq i.group [aw = count] if sample1 == 1, cluster(metarea)
ivregress 2sls ln_share_occ_1d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L1.blackXln_active L1.blackXln_active_sq L1.ln_active L1.ln_active_sq i.group i.edXmetarea [aw = count] if sample1 == 1, cluster(metarea)

sum ln_share_occ_1d if e(sample)
sum ln_share_occ_1d if e(sample) & race == 1
sum ln_share_occ_1d if e(sample) & race == 2

areg ln_share_occ_2d racc70 blackXracc70 rcarea70 blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq [aw = count] if sample2 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_occ_2d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq i.group [aw = count] if sample2 == 1, cluster(metarea)
ivregress 2sls ln_share_occ_2d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L2.blackXln_active L2.blackXln_active_sq L2.ln_active L2.ln_active_sq i.group i.edXmetarea [aw = count] if sample2 == 1, cluster(metarea)

sum ln_share_occ_2d if e(sample)
sum ln_share_occ_2d if e(sample) & race == 1
sum ln_share_occ_2d if e(sample) & race == 2

areg ln_share_occ_3d racc70 blackXracc70 rcarea70 blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1, absorb(group) cluster(metarea)
ivregress 2sls ln_share_occ_3d (racc70 blackXracc70 = raysxplan70 blackXraysxplan70) rcarea70 blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq i.group [aw = count] if sample3 == 1, cluster(metarea)
ivregress 2sls ln_share_occ_3d (blackXracc70 = blackXraysxplan70) blackXrcarea70 L3.blackXln_active L3.blackXln_active_sq L3.ln_active L3.ln_active_sq i.group i.edXmetarea [aw = count] if sample3 == 1, cluster(metarea)

sum ln_share_occ_3d if e(sample)
sum ln_share_occ_3d if e(sample) & race == 1
sum ln_share_occ_3d if e(sample) & race == 2

/*----------------------------------------------------------------------*/
*TABLE A4: HETEROGENEOUS EFFECTS OF JOB SUBURBANIZATION
/*----------------------------------------------------------------------*/

**by education

*employment rates
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1 & educ_cat == 1, absorb(group) cluster(metarea)
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1 & educ_cat == 2, absorb(group) cluster(metarea)
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1 & educ_cat == 3, absorb(group) cluster(metarea)

*earnings
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1 & educ_cat == 1, absorb(group) cluster(metarea)
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1 & educ_cat == 2, absorb(group) cluster(metarea)
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1 & educ_cat == 3, absorb(group) cluster(metarea)


**by gender

*employment rates
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1 & sex == 1, absorb(group) cluster(metarea)
areg ln_active_3d blackXln_fcc_3d L3.blackXln_active L3.blackXln_active_sq ln_fcc_3d L3.ln_active L3.ln_active_sq [aw = count] if sample3 == 1 & sex == 2, absorb(group) cluster(metarea)

*earnings
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1 & sex == 1, absorb(group) cluster(metarea)
areg ln_inc_3d blackXln_fcc_3d L3.blackXln_inc L3.blackXln_inc_sq ln_fcc_3d L3.ln_inc L3.ln_inc_sq [aw = count] if sample3 == 1 & sex == 2, absorb(group) cluster(metarea)



/*------------------------------------------------------------
*NOTE: SAVE FOR MIGRATION TABLE
------------------------------------------------------------*/

preserve

keep if year == 1980 & matched_msas == 1
keep year metarea race sex cohort_cat educ_cat group ln_fcc_1d blackXln_fcc_1d

save "${datadir}migration_temp.dta", replace

restore


/*------------------------------------------------------------
*TABLE
*NOTE: HIGHWAYS AND BASELINE MSA CHARACTERISTICS
------------------------------------------------------------*/

areg active_fd5yr blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg ln_active_fd5yr blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 1970 & size25 == 1 & matched_msas, absorb(group) cluster(metarea)


areg L1.active blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L3.active blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 2000 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L1.ln_inc blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg L1.fcc blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	[aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg fblack_msa blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)



areg z_violent_rate blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)

areg z_property_rate blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)
	 

areg L1.dism blackXracc70 blackXrcarea70 racc70 rcarea70 ///
	 [aw = count] if year == 1980 & size25 == 1 & L1.size25 == 1 & matched_msas, absorb(group) cluster(metarea)



log close


